import java.util.Scanner;

public class demo05 {
    //螺旋矩阵
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int r=sc.nextInt();
        int c=sc.nextInt();
        int[][] arr=new int[n][m];
        int i=0;
        int j=0;
        int a=1;
        while (a <= m*n) {
            while (j<m&&arr[i][j]==0){
                arr[i][j++]=a++;
            }
            j--;
            i++;
            while (i<n&&arr[i][j]==0){
                arr[i++][j]=a++;
            }
            i--;
            j--;
            while (j>=0&&arr[i][j]==0){
                arr[i][j--]=a++;
            }
            j++;
            i--;
            while (i>0&&arr[i][j]==0){
                arr[i--][j]=a++;
            }
            i++;
            j++;
        }
        System.out.println(arr[r-1][c-1]);
    }
}
